var app = angular.module('app', ['ui.router', 'controllers']);
app.config(['$stateProvider', '$urlRouterProvider', '$locationProvider', function ($stateProvider, $urlRouterProvider, $locationProvider) {
    $urlRouterProvider.otherwise('/');
    // $locationProvider.html5Mode(true);//去掉url里面的#
    $stateProvider
        .state('form', {
            url: '/:tabIndex/:activity_id',
            templateUrl: 'pages/quiz/form.html',
            controller: 'formController',
            cache: true,
            onEnter: function () {
            },
            onExit: function () {
            }
        })
        .state('template', {
            url: '/template/:activity_id/:isEdit/:isPreview',
            templateUrl: 'pages/quiz/template.html',
            controller: 'templateController',
            cache: true,
            onEnter: function () {
            },
            onExit: function () {
            }
        })
        .state('export', {
            url: '/export',
            templateUrl: 'pages/quiz/export.html',
            controller: 'exportController',
            cache: true,
            onEnter: function () {
            },
            onExit: function () {
            }
        })
        .state('sheet', {
        url: '/sheet',
        templateUrl: 'pages/quiz/sheet.html',
        controller: 'sheetController',
        cache: true,
        onEnter: function () {
        },
        onExit: function () {
        }
    });
}]);
app.run(['$rootScope', '$window', '$location', '$log', '$templateCache', function ($rootScope, $window, $location, $log, $templateCache) {
    var statechangeSuccess = $rootScope.$on('$stateChangeSuccess', stateChangeSuccess);

    function stateChangeSuccess($rootScope) {
        // $templateCache.removeAll();
    }
}]);